<template>
  <div class="search">
    <div class="head">
      <div class="iconfont icon-arrdown-copy" @click="$router.go(-1)"></div>
      <input type="text" value="目的地/酒店/景点/关键字" />
      <i class="iconfont icon-fangdajing"></i>
    </div>
    <h2>热门搜索</h2>
    <div class="list">
      <span v-for="(item,index) in datalist" :key="index" @click="$router.push('/beijing')">{{item.name}}</span>
    </div>
  </div>
</template>

<script>
import { get, post } from "@/api/http";
export default {
    data(){
        return {
            datalist:{}
        }
    },
  created() {
    this.getList();
  },
  methods: {
    async getList() {
      let rs = await get("/api/response");
      this.datalist = rs.data.result.doc;
    //   console.log(rs);
    },
  },
};
</script>

<style lang="scss" scoped>
.search {
  width: 100%;
  height: 100%;
  .head {
    width: 100%;
    height: 50px;
    // background: #ff6815;
    display: flex;
    justify-content: space-between;

    div {
      font-size: 25px;
      color: #00c777;
      margin-left: 5.15625%;
      line-height: 50px;
      font-weight: 900;
    }
    input {
      width: 295px;
      height: 33px;
      border: none;
      background: #eaedf1;
      border-radius: 16px;
      text-align: center;
      margin-right: 2.5%;
      margin-top: 8px;
      font-size: 15px;
      color: #8f8f97;
      font-weight: 500;
      position: relative;
      outline: none;
    }
    i {
      position: absolute;
      top: 16px;
      left: 115px;
      font-size: 20px;
      color: #8f8f97;
      font-weight: 700;
    }
  }
  h2 {
    width: 340px;
    height: 32px;
    margin: 0 auto;
    // background: olive;
    color: #999;
    font-size: 14px;
    line-height: 32px;
    font-weight: 400;
  }
  .list {
    width: 340px;
    height: 114px;
    // background: olivedrab;
    margin: 0 auto;
    span {
      padding: 15px 0 10px;
      margin: 6px 12px 6px 0;
      display: inline-block;
      padding: 6px 19px;
      font-size: 14px;
      color: #333333;
      border-radius: 3px;
      background: #f5f5f5;
      overflow: hidden;
      text-overflow: ellipsis;
      -o-text-overflow: ellipsis;
      white-space: nowrap;

    }
    span:nth-child(1){
        color: #ff6815  ;
    }
    span:nth-child(5){
        color: #ff6815  ;
    }
    span:nth-child(4){
        color: #ff6815  ;
    }
  }
}
</style>
